package com.chencs.app.shop.controller;

import com.alibaba.fastjson.JSON;
import com.chencs.app.shop.service.AppShopService;
import com.chencs.vo.biz.shop.NewShopModel;
import com.chencs.vo.biz.shop.ShopModel;
import com.chencs.vo.net.request.ShopRequest;
import com.chencs.vo.net.response.NewShopResponse;
import com.chencs.vo.net.response.ShopInfoResponse;
import com.chencs.vo.net.response.ShopResponse;
import framework.model.ResponseOptUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2017/10/10.
 */

@RestController
@RequestMapping("/app/shop")
public class AppShopController {


    @Autowired
    private AppShopService appShopService;

    /**
     *
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getShopList(@RequestBody ShopRequest request){
        String retStr = "";
        try {
            retStr = appShopService.getShopList(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }


    @RequestMapping(value = "/getShopInfo", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getShopInfo(@RequestBody ShopRequest request){
        String retStr = "";
        try {
            retStr = appShopService.getShopInfo(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }


    @RequestMapping(value = "/getShopList", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getNewShopList(@RequestBody ShopRequest request){
        String retStr = "";
        try {
            retStr = appShopService.getNewShopList(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }

}
